package com.joe.learn.dubbo.client;

import com.joe.learn.dubbo.service.RegistryService;
import org.springframework.context.support.ClassPathXmlApplicationContext;
 
public class Consumer {
 
    public static void main(String[] args) throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"/spring/dubbo-spring.xml"});
        context.start();

        RegistryService demoService = (RegistryService) context.getBean("registryService"); // 获取远程服务代理

        for(int i=0;i<1000;i++){
            String hello = demoService.hello("world"); // 执行远程方法
            System.out.println(hello); // 显示调用结果

        }

    }
 
}